17. Araxis Merge File Comparison Report

Produced by Araxis Merge on 2020-08-17 08:36:36 +0000. See www.araxis.com for information about Merge. This report uses XHTML and CSS2, and is best viewed with a modern standards-compliant browser. For optimum results when printing this report, use landscape orientation and enable printing of background images and colours in your browser.

17.1 Files compared

#LocationFileLast Modified
1/Applications/Ampps/www/Porto 3.2.2/Porto v3.2.4/Theme Files/Magento 2.x/Porto Theme/app/design/frontend/Smartwave/porto/Magento_Wishlist/web/jsadd-to-wishlist.js2015-11-16 19:50:12 +0000
22020-08-17 08:36:36 +0000

17.2 Comparison summary

DescriptionBetween
Files 1 and 2
Text BlocksLines
Unchanged00
Changed00
Inserted00
Removed1138

17.3 Comparison options

WhitespaceConsecutive whitespace is treated as a single space
Character caseDifferences in character case are significant
Line endingsDifferences in line endings (CR and LF characters) are ignored
CR/LF charactersNot shown in the comparison detail
Active line-pairing rules

17.4 Active regular expressions

No regular expressions were active.

17.5 Comparison detail

1 /**    
2  * Copyright © 2015 Magento. All rights reserved.    
3  * See COPYING.txt for license details.    
4  */    
5 /*jshint browser:true jquery:true*/    
6 define([    
7     "jquery",    
8     "jquery/ui"    
9 ], function($){    
10     "use strict";    
11         
12     $.widget('mage.addToWishlist', {    
13         options: {    
14             bundleInfo: 'div.control [name^=bundle_option]',    
15             configurableInfo: '.super-attribute-select',    
16             groupedInfo: '#super-product-table input',    
17             downloadableInfo: '#downloadable-links-list input',    
18             customOptionsInfo: '.product-custom-option',    
19             qtyInfo: '#qty'    
20         },    
21         _create: function () {    
22             this._bind();    
23         },    
24         _bind: function() {    
25             var changeCustomOption = 'change ' + this.options.customOptionsInfo,    
26                 changeQty = 'change ' + this.options.qtyInfo,    
27                 changeProductInfo = 'change ' + this.options[this.options.productType + 'Info'],    
28                 events = {};    
29             events[changeCustomOption] = '_updateWishlistData';    
30             events[changeProductInfo] = '_updateWishlistData';    
31             events[changeQty] = '_updateWishlistData';    
32             this._on(events);    
33         },    
34         _updateWishlistData: function(event) {    
35             var dataToAdd = {},    
36                 isFileUploaded = false;    
37             if (event.handleObj.selector == this.options.qtyInfo) {    
38                 this._updateAddToWishlistButton({});    
39                 event.stopPropagation();    
40                 return;    
41             }    
42             var self = this;    
43             $(event.handleObj.selector).each(function(index, element){    
44                 if ($(element).is('input[type=text]')    
45                     || $(element).is('input[type=email]')    
46                     || $(element).is('input[type=number]')    
47                     || $(element).is('input[type=hidden]')    
48                     || $(element).is('input[type=checkbox]:checked')    
49                     || $(element).is('input[type=radio]:checked')    
50                     || $(element).is('textarea')    
51                     || $('#' + element.id + ' option:selected').length    
52                 ) {    
53                     dataToAdd = $.extend({}, dataToAdd, self._getElementData(element));    
54                     return;    
55                 }    
56                 if ($(element).is('input[type=file]') && $(element).val()) {    
57                     isFileUploaded = true;    
58                 }    
59             });    
60             if (isFileUploaded) {    
61                 this.bindFormSubmit();    
62             }    
63             this._updateAddToWishlistButton(dataToAdd);    
64             event.stopPropagation();    
65         },    
66         _updateAddToWishlistButton: function(dataToAdd) {    
67             var self = this;    
68             $('[data-action="add-to-wishlist"]').each(function(index, element) {    
69                 var params = $(element).data('post');    
70                 if (!params)    
71                     params = {'data': {}};    
72     
73                 if (!$.isEmptyObject(dataToAdd)) {    
74                     self._removeExcessiveData(params, dataToAdd);    
75                 }    
76     
77                 params.data = $.extend({}, params.data, dataToAdd, {'qty': $(self.options.qtyInfo).val()});    
78                 $(element).data('post', params);    
79             });    
80         },    
81         _arrayDiffByKeys: function(array1, array2) {    
82             var result = {};    
83             $.each(array1, function(key, value) {    
84                 if (key.indexOf('option') === -1) {    
85                     return;    
86                 }    
87                 if (!array2[key])    
88                     result[key] = value;    
89             });    
90             return result;    
91         },    
92         _getElementData: function(element) {    
93             var data = {};    
94             if ($(element).attr('id')) {    
95                 var elementName = $(element).attr('id').replace(/[^_]+/, 'options').replace(/_(\d+)/g, '[$1]'),    
96                     elementValue = $(element).val();    
97                 if ($(element).is('select[multiple]') && elementValue !== null) {    
98                     if (elementName.substr(elementName.length - 2) == '[]') {    
99                         elementName = elementName.substring(0, elementName.length - 2);    
100                     }    
101                     $.each(elementValue, function (key, option) {    
102                         data[elementName + '[' + option + ']'] = option;    
103                     });    
104                 } else {    
105                     if (elementValue) {    
106                         data[elementName] = elementValue;    
107                     }    
108                 }    
109             }    
110             return data;    
111         },    
112         _removeExcessiveData: function(params, dataToAdd) {    
113             var dataToRemove = this._arrayDiffByKeys(params.data, dataToAdd);    
114             $.each(dataToRemove, function(key, value) {    
115                 delete params.data[key];    
116             });    
117         },    
118         bindFormSubmit: function() {    
119             var self = this;    
120             $('[data-action="add-to-wishlist"]').on('click', function(event) {    
121                 event.stopPropagation();    
122                 event.preventDefault();    
123     
124                 var element = $('input[type=file]' + self.options.customOptionsInfo),    
125                     params = $(event.currentTarget).data('post'),    
126                     form = $(element).closest('form'),    
127                     action = params.action;    
128                 if (params.data.uenc) {    
129                     action += 'uenc/' + params.data.uenc;    
130                 }    
131     
132                 $(form).attr('action', action).submit();    
133             });    
134         }    
135     });    
136         
137     return $.mage.addToWishlist;    
138 });